package zb.thr4;

import java.util.Random;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

/**
 * @author wzby
 * @Date: 2022/8/8 20:26
 */
public class T1 {
    public static void main(String[] args) {
        ExecutorService es = Executors.newCachedThreadPool();
        for (int i= 0 ; i < 15;i++){
            es.submit(() -> {
                try {
                    Random rand = new Random();
                    TimeUnit.SECONDS.sleep(rand.nextInt(1,5));
                }catch (Exception e){
                    e.printStackTrace();
                }
                System.out.println(Thread.currentThread().getName());
            });
        }
        es.shutdown();
        System.out.println("main");
    }
}
